package com.totoro.tygeneratedragonblock.executor.command.impl;

import com.totoro.tygeneratedragonblock.TyGenerateDragonBlock;
import com.totoro.tygeneratedragonblock.executor.command.MainCommandExecutor;
import com.totoro.tygeneratedragonblock.utils.ColorUtil;
import org.bukkit.command.CommandSender;

/**
 * @author Totoro
 * @version 0.1.0
 * @date 2025/8/10 - 18:41
 * @description
 **/
public class ReloadCommandExecutor implements MainCommandExecutor {
    @Override
    public void execute(TyGenerateDragonBlock plugin, CommandSender sender, String[] args) {
        if(!judgePermission(plugin, sender, null)) {
            return;
        }
        plugin.getConfigManager().reloadConfig();
        plugin.getLanguageManager().reloadLanguage();
        plugin.getBlocksManager().reloadBlocksFile();
        plugin.getSpawnersManager().reloadSpawnersFile();
        plugin.getRespawnTasksManager().generateForLoadedChunks();
        sender.sendMessage(plugin.getConfigManager().getConfig().getPrefix() + ColorUtil.color("&e重载成功！"));
    }
}
